﻿﻿@model Zor_Web.Models.Sincerity.V_Sincerity
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;

@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>楼宇信息列表</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <style>
        .title {
            font-size: 16px;
            font-weight: bold;
            line-height: 40px;
        }
    </style>

</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">
        <div class="col-sm-12 ct-padding">
            <div class="col-sm-6 ct-padding">
                <button id="btnMessage" class="layui-btn layui-btn-orchid layui-btn-small"><span class="glyphicon glyphicon-list-alt"></span> 详情</button>
            </div>
            <div class="col-sm-6 ct-padding">
                <form action="/Sincerity/Sincerity" method="post" class="form-horizontal">
                    <div class="layui-form-item">
                        <div class="col-sm-3"></div>
                        <label class="col-sm-3 layui-form-label" style="text-align:right;">查询条件：</label>
                        <div class="col-sm-5">
                            <input class="form-control" style="width:100%" name="where" value="@TempData["where"]" placeholder="请输入姓名/联系方式/证件号码" />
                        </div>
                        <div class="col-sm-1" style="text-align:left;">
                            <input type="submit" value="查询" class="form-inline layui-btn layui-btn-normal layui-btn-small" />
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="col-sm-12  layui-tab-content">
            <div class="mail-box" style="overflow-x:scroll;white-space:nowrap;">
                <table class="layui-table">
                    <thead>
                        <tr style="text-align:center;">
                            <th rowspan="2"><input type="checkbox" name="checkAll" id="cbkCheckAll"></th>
                            <th hidden style="text-align:center;" rowspan="2">序号</th>
                            <th style="text-align:center;" colspan="3">出租方</th>
                            <th style="text-align:center;" colspan="3">承租方</th>
                            <th style="text-align:center;" colspan="3">经办人</th>
                            <th style="text-align:center;" rowspan="2">起始日期</th>
                            <th style="text-align:center;" rowspan="2">结束日期</th>
                            <th rowspan="2" hidden>合同</th>
                            <th rowspan="2" hidden>街办</th>
                            <th rowspan="2" hidden>社区</th>
                            <th rowspan="2" hidden>楼宇</th>
                            <th rowspan="2" hidden>单元</th>
                            <th rowspan="2" hidden>房屋</th>
                            <th rowspan="2" hidden>地址</th>
                            <th rowspan="2" hidden>金额</th>
                            <th rowspan="2" hidden>审核状态</th>
                        </tr>
                        <tr>
                            <th>姓名/企业名称</th>
                            <th>手机码号</th>
                            <th>证件号码</th>

                            <th>姓名/企业名称</th>
                            <th>手机码号</th>
                            <th>证件号码</th>

                            <th>姓名</th>
                            <th>手机码号</th>
                            <th>身份证号</th>
                        </tr>
                    </thead>
                    <tbody id="accordion">

                        @foreach (var item in Model.PageData)
                        {


                            <tr>
                                <td><input type="checkbox" name="chk" id="@item.Property_Id" value="@item.Property_Id" /></td>
                                <td hidden>@item.Property_Id</td>
                                <td>@item.LessorName</td>
                                <td>@item.LessorCell</td>
                                <td>@item.LessorIDCardNo</td>
                                <td>@item.LesseeName</td>
                                <td>@item.LesseeCell</td>
                                <td>@item.LesseeIDCardNo</td>
                                <td>@item.UserName</td>
                                <td>@item.UserCell</td>
                                <td>@item.UserCardId</td>
                                <td>@TimeHelper.TimeStampToDateTime(item.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                                <td>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                                <td hidden>@item.Property_LeaseContract</td>
                                <td hidden>@item.Dt_ParentName</td>
                                <td hidden>@item.Dt_Name</td>
                                <td hidden>@item.Bd_Name</td>
                                <td hidden>@item.Uim_Name</td>
                                <td hidden>@item.Hs_Number</td>
                                <td hidden>@item.Address</td>
                                <td hidden>@item.Rent</td>
                                <td hidden>@item.AuditStatus</td>
                            </tr>
                        }
                    </tbody>
                </table>
                <div class="col-sm-12">
                    <div class="col-sm-10">
                        @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
                    </div>
                    <div class="col-sm-2 to-righjt">
                        共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 详情模态 -->
    <div id="myModalMessage" hidden data-backdrop="static">
        <div id="divfrom" class="layui-tab-content">
            <form class="form-horizontal m-t" style="margin-bottom:20px;">
                <div class="layui-form-item">
                    <div class="col-sm-12 title">房屋信息</div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">街办名称：</label>
                    <div class="col-sm-4 layui-input" id="Dt_ParentName"></div>
                    <label class="col-sm-2 layui-form-label">社区名称：</label>
                    <div class="col-sm-4 layui-input" id="Dt_Name"></div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">楼宇名称：</label>
                    <div class="col-sm-4 layui-input" id="Bd_Name"></div>
                    <label class="col-sm-2 layui-form-label">单元名称：</label>
                    <div class="col-sm-4 layui-input" id="Uim_Name"></div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">房屋名称：</label>
                    <div class="col-sm-4 layui-input" id="Hs_Number"></div>
                    <label class="col-sm-2 layui-form-label">详情地址：</label>
                    <div class="col-sm-4 layui-input" id="Address"></div>
                </div>

                <div class="layui-form-item">
                    <div class="col-sm-12 title">出租人信息</div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">名称：</label>
                    <div class="col-sm-4 layui-input" id="LessorName"></div>
                    <label class="col-sm-2 layui-form-label">手机号：</label>
                    <div class="col-sm-4 layui-input" id="LessorCell"></div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">证件号码：</label>
                    <div class="col-sm-4 layui-input" id="LessorIDCardNo"></div>
                </div>

                <div class="layui-form-item">
                    <div class="col-sm-12 title">承租人信息</div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">名称：</label>
                    <div class="col-sm-4 layui-input" id="LesseeName"></div>
                    <label class="col-sm-2 layui-form-label">手机号：</label>
                    <div class="col-sm-4 layui-input" id="LesseeCell"></div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">证件号码：</label>
                    <div class="col-sm-4 layui-input" id="LesseeIDCardNo"></div>
                </div>


                <div class="layui-form-item">
                    <div class="col-sm-12 title">经办人信息</div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">姓名：</label>
                    <div class="col-sm-4 layui-input" id="UserName"></div>
                    <label class="col-sm-2 layui-form-label">手机号：</label>
                    <div class="col-sm-4 layui-input" id="UserCell"></div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">身份证号：</label>
                    <div class="col-sm-4 layui-input" id="UserCardId"></div>
                </div>
                <div class="layui-form-item title">
                    <div class="col-sm-12">租赁信息</div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">租赁金额：</label>
                    <div class="col-sm-2 layui-input" id="Rent"></div>
                    <label class="col-sm-2 layui-form-label">开始日期：</label>
                    <div class="col-sm-2 layui-input" id="Lease_StartTime"></div>
                    <label class="col-sm-2 layui-form-label">结束日期：</label>
                    <div class="col-sm-2 layui-input" id="Lease_EndTime"></div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">租赁合同：</label>
                    <div class="col-sm-4" id="Property_LeaseContract"></div>
                </div>
            </form>
        </div>
    </div>

</body>

</html>
<script>
    //远程API地址
    var apiUrl = "@Zor_API.PropertyInfo.apiPath";
    /**
    * 全选
    */
    $(function () {
        $("#cbkCheckAll").click(function () {
            if (this.checked) {
                $("input[name='chk']").prop('checked', true);
            } else {
                $("input[name='chk']").prop('checked', false);
            }
        })
    })
    /**
    * 信息详情
    */
    $(function () {
        $("#btnMessage").click(function () {
            var checkId = CheckboxValueIDs();
            var Hs_Number = getTableCell(2);    //获取选中行的房屋Id
            if (checkId.length == 0) {
                layer.msg("请选择要审核的信息！");
                return;
            } else if (checkId.length > 1) {
                layer.msg("仅可选择一条信息！");
                return;
            } else {

                $("#Property_Id").html(getTableCell(1));
                $("#LessorName").html(getTableCell(2));
                $("#LessorCell").html(getTableCell(3));
                $("#LessorIDCardNo").html(getTableCell(4));
                $("#LesseeName").html(getTableCell(5));
                $("#LesseeCell").html(getTableCell(6));
                $("#LesseeIDCardNo").html(getTableCell(7));
                $("#UserName").html(getTableCell(8));
                $("#UserCell").html(getTableCell(9));
                $("#UserCardId").html(getTableCell(10));
                $("#Lease_StartTime").html(getTableCell(11));
                $("#Lease_EndTime").html(getTableCell(12));
                var ary = getTableCell(13);
                var temp = "";
                if (ary == "" || ary == null || ary == "null") {
                    temp = "暂无";
                } else {
                    var count = 0;
                    var imgs = ary.substring(0, ary.lastIndexOf(','));
                    if (imgs.indexOf(",") > 0) {
                        var imageUrl = imgs.split(',');
                        for (var i = 0; i < imageUrl.length; i++) {
                            temp += "<img style='margin-top:10px' src='" + apiUrl + imageUrl[i] + "' alt='' id='Property_LeaseContract" + i + "' width='500'  />";
                        }
                    } else {
                        temp += "<img src='" + apiUrl + imgs + "' alt='' id='Property_LeaseContract' width='500'  />";
                    }
                }
                $("#Property_LeaseContract").html(temp);
                $("#Dt_ParentName").html(getTableCell(14));
                $("#Dt_Name").html(getTableCell(15));
                $("#Bd_Name").html(getTableCell(16));
                $("#Uim_Name").html(getTableCell(17));
                $("#Hs_Number").html(getTableCell(18));
                $("#Address").html(getTableCell(19));
                $("#Rent").html(getTableCell(20));
                LayerOpen('800px', '600px', '详情', $('#myModalMessage'));

            }
            return;
        });
    });

</script>
